<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../link.html"%>
<!DOCTYPE html>
<script type="text/javascript">
$(document).ready(function() {
	$("#btn-close").click( function () { 
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index); //再执行关闭 
	});
});

function editBed(){
	var index=$('#btn-submit').attr('class').indexOf("disabled");
	if(index==-1){//disabled的下标为-1说明确定按钮可用
		$.ajax({
	        type:"post",
	        url:"editBed",
	        data: $('#form').serialize(),//表单数据
	        success: function(data){
	        	layer.msg('修改成功', {icon: 1, time: 800}, function(){//关闭后执行的操作
					var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
					parent.layer.close(index); //再执行关闭 
				});  
	        }
	    });
	}
	return false;
}
</script>

<div style="padding-top:25px;">
	<form id="form" method="post" class="form-horizontal">
	
		<div class="form-group">
			<label  class="col-sm-4 control-label">ID</label>
			<div class="col-sm-5">
				<input name="bedid" value="${bed.bedid}" class="form-control" readonly>
			</div>
		</div>
		
		<div class="form-group">
			<label  class="col-sm-4 control-label">类型名称</label>
			<div class="col-sm-5">
				<input id="name" name="name" value="${bed.name}" class="form-control" autofocus="autofocus" required>
			</div>
			<div class="help-block with-errors"></div>
		</div>

		<div class="form-group">
			<label class="col-sm-4 control-label">规格</label>
			<div class="col-sm-5">
				<input id="size" name="size" value="${bed.size}" class="form-control">
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-sm-4 control-label">详细说明</label>
			<div class="col-sm-5">
				<textarea id="other" name="other" class="form-control">${bed.other}</textarea>
			</div>
		</div>

		<div class="box-footer"></div>
		
		<div class="form-group">
			<label class="col-sm-4 control-label"></label>
			<div class="col-sm-5">
				<div class="pull-right">
					<button id="btn-submit" type="submit" class="btn btn-primary" onClick="return editBed()">
						<i class="fa fa-floppy-o "></i> 确定
					</button>
					<button id="btn-close" class="btn btn-close btn-primary" type="button">
						<i class="fa fa-remove"></i> 关闭
					</button>
				</div>
			</div>
		</div>
	</form>
</div>